//
//  TranslationCell.m
//  XhlTrip
//
//  Created by dlios on 15/9/29.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "TranslationCell.h"

@implementation TranslationCell

- (void)awakeFromNib {
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backView = [[UIView alloc]init];
        _backView.backgroundColor = [UIColor colorWithRed:131/ 255.f green:190/ 255.f blue:255 / 255.f alpha:0.5];
        
        [self.contentView addSubview:_backView];
        

        self.to = [[UILabel alloc]init];
        self.to.textColor = [UIColor greenColor];
        [self.backView addSubview:_to];
        
        self.from = [[UILabel alloc]init];
        self.from.textColor = [UIColor whiteColor];
        self.from.font = [UIFont systemFontOfSize:15];
        [self.backView addSubview:_from];
        
        
        self.line = [[UILabel alloc]init];
        self.line.backgroundColor = [UIColor whiteColor];
        [self.backView addSubview:_line];
        
        self.bound = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.bound setTintColor:[UIColor whiteColor]];
        [self.bound addTarget:self action:@selector(bound:) forControlEvents:UIControlEventTouchUpInside];
        [self.bound setImage:[UIImage imageNamed:@"quanping.png"] forState:UIControlStateNormal];
        [self.backView addSubview:_bound];
        
        self.delet = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.delet setTintColor:[UIColor whiteColor]];
        [self.delet addTarget:self action:@selector(delet:) forControlEvents:UIControlEventTouchUpInside];

        [self.delet setImage:[UIImage imageNamed:@"shanchu.png"] forState:UIControlStateNormal];
        [self.backView addSubview:_delet];
        
        
        
    }
    
    return self;
}
-(void)layoutSubviews{
    
    [super layoutSubviews];
    self.to.frame = CGRectMake(10, 0, self.contentView.frame.size.width, 40);
    self.from.frame = CGRectMake(10, 35, self.contentView.frame.size.width, 40);
    self.line.frame = CGRectMake(10, 80, self.contentView.frame.size.width - 20, 1);
    self.bound.frame = CGRectMake(80, 90,25, 25);
    self.delet.frame = CGRectMake(255, 90, 25, 25);
    self.backView.frame  = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 5);
}
- (void)bound:(UIButton *)button
{
    [self.delegate gotoBound:(UIButton *)button];
    
}

- (void)delet:(UIButton *)sender
{
    [self.delegate gotoDelete:sender];
}
@end
